﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wlog.Model;

namespace wlog.Shell.Storage.Queue
{
    public class QueueCreateCommand : QueueStorageCommand
    {
        public override void Setup(string[] args)
        {
            base.Setup(args);
            base.CreateTask(() => { RunCommand(); });
        }
        public OutputChannel RunCommand()
        {
            try
            {
                string otype = this.objectName;
                var QueueAPI = GetQueueAccount();
                var queue = QueueAPI.GetQueueReference(otype);
                bool created = queue.CreateIfNotExists();
                Results.WriteLine("Queue created {0} ", otype);
            }
            catch (Exception azureEx)
            {
                Results.WriteLine("Error ccreating Queue {0} ", azureEx.Message);
            }
            return Results;
        }

    }
}
